home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX 6.2 Applications 1996 May
/
SGI IRIX 6.2 Applications 1996 May.iso
/
dist
/
impr_dev.idb
/
usr
/
impressario
/
src
/
drivers
/
laserjetPJL
/
laserjetPJL.h.z
/
laserjetPJL.h
Wrap
C/C++ Source or Header
|
1996-05-06
|
5KB
|
145 lines
/**************************************************************************
*
* Copyright (c) 1992 Silicon Graphics, Inc.
* All Rights Reserved
*
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF SGI
*
* The copyright notice above does not evidence any actual of intended
* publication of such source code, and is an unpublished work by Silicon
* Graphics, Inc. This material contains CONFIDENTIAL INFORMATION that is
* the property of Silicon Graphics, Inc. Any use, duplication or
* disclosure not specifically authorized by Silicon Graphics is strictly
* prohibited.
*
* RESTRICTED RIGHTS LEGEND:
*
* Use, duplication or disclosure by the Government is subject to
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights in
* Technical Data and Computer Software clause at DFARS 52.227-7013,
* and/or in similar or successor clauses in the FAR, DOD or NASA FAR
* Supplement. Unpublished - rights reserved under the Copyright Laws of
* the United States. Contractor is SILICON GRAPHICS, INC., 2011 N.
* Shoreline Blvd., Mountain View, CA 94039-7311
**************************************************************************
*
* Description:
* Printer driver for HP LaserJet family of printers.
*
* See Also:
* laserjetPJL.c
*
**************************************************************************/
#include <unistd.h>
#include <signal.h>
#include <getopt.h>
#include <stdlib.h>
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#include <bstring.h>
#include <sys/file.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
#include <fcntl.h>
#include <pod.h>
#include <printstiff.h>
#include <sys/prctl.h>
#include "safeMemory.h"
/* A few global vars and constants defined here: */
typedef unsigned int boolean;
#define FALSE 0
#define TRUE 1
/* Debugging message levels of detail */
#define COARSEDETAIL 1
#define MEDIUMDETAIL 2
#define FINEDETAIL 3
/* Page validation masks, by resolution */
#define PAGEMASK_300 0x20
#define PAGEMASK_600 0x40
/* Masks for full-bleed B size on 4V */
#define PAGEMASK_BLEED_300 0x01
#define PAGEMASK_BLEED_600 0x02
/* Default paper size support, change these for different defaults */
#define LJ_DEFAULT_PAGE_SIZE PD_SIZE_A
/* Whether options are from command line or image header */
#define COMMANDLINE 0
#define IMAGEHEADER 1
#define MAXNUMARGS 512 /* max number of imageheader options line args */
static const char* DELIMITER_STRING = " \t\n"; /* String word separators */
/* Data formats allowed */
static unchar IMAGE_FORMATS[][8] = { "Unknown", "Packed", "Planar" };
#define N_IMAGE_FORMATS (sizeof IMAGE_FORMATS / sizeof IMAGE_FORMATS[0])
static unchar IMAGE_TYPES[][8] = { "K", "W", "RGB", "CMAP",
"MASK", "CMY[K]", "YMC", "YMCK", "UNKNOWN" };
#define N_IMAGE_TYPES (sizeof IMAGE_TYPES / sizeof IMAGE_TYPES[0])
#define DEFAULT_MSG NULL /* Used in add_error_message */
/* Exit codes on errors. XXX These should be in the man page. */
#define NO_ERROR 0
#define UNKNOWN 1
#define BAD_ARG 2
#define BAD_POD_ACCESS 3
#define BAD_DEVICE_NAME 4
#define BAD_DEVICE_TYPE 5
#define BAD_STATUS_UPDATE 6
#define BAD_DEVICE_ACCESS 7
#define BAD_MEMORY_REFERENCE 8
#define BAD_MEMORY_ALLOC 9
#define BAD_DATA_FORMAT 10
#define BAD_DATA_HEADER 11
#define BAD_DATA_SHORT_FILE 12
#define BAD_CODE_SHORT_FILE 13
#define BAD_DATA_FILE 14
#define BAD_TRANSMISSION 15
#define BAD_DATA_BUFFER 16
#define BAD_TEST_PRINT 17
#define BAD_COMPRESSION 18
/***********************************************************************
*
* Prototypes:
*
***********************************************************************/
void set_program_name(const char* name);
void hold_signals(void);
void release_signals(void);
void print_usage_message(void);
void process_header_options(char* options);
boolean process_args(int argc, char* argv[]);
int initialize_printer(FILE *out);
void cleanup_and_quit(const int exitcode);
void setup_signal_handler(void);
boolean read_image_header(STStream *datafile, PSTImageHeader *imghdr);
void print_image_info(PSTImageHeader *imghdr);
boolean read_image_data(STStream* datafile, int imgbytes, unchar* pagebuf);
boolean is_valid_format(PSTImageHeader *imghdr );
boolean send_image(FILE *out, PSTImageHeader *imghdr, unchar *imagebuffer);
void add_error_message(const int error_code, const char* error_string);
int update_status(const int cur_status);
void send_pcl_file(void);
void send_stiff_file(void);